package com.diudiutechnology.www.yadiudiu.yadiudiu.mine.MyActivity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.diudiutechnology.www.yadiudiu.yadiudiu.mine.MyAdapter.TransactionDetailsActivityAdapter;
import com.diudiutechnology.www.yadiudiu.yadiudiu.model.BuyACarFragmentModel;
import com.diudiutechnology.www.yadiudiu.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/8/18.
 */

public class TransactionDetailsActivity extends Activity implements View.OnClickListener {
    Context context;
    @Bind(R.id.transaction_details_list)
    ListView transactionDetailsList;
    private List<BuyACarFragmentModel> houselist;
    TransactionDetailsActivityAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transaction_details);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        context = this;
        adapter=new TransactionDetailsActivityAdapter(this);
        transactionDetailsList.setAdapter(adapter);
        initData();
    }
    //数据
    private void initData() {
        houselist = new ArrayList<>();
        houselist.clear();
        BuyACarFragmentModel model = new BuyACarFragmentModel();
        model.setName("充值余额");
        model.setPraise("");
        model.setLet("余额: 1013.98");
        model.setMoney1("+1000.00");
        model.setDate("0");
        model.setDistance("2017-8-17");
        houselist.add(model);

        model = new BuyACarFragmentModel();
        model.setName("余额提现");
        model.setPraise("");
        model.setLet("余额: 13.98");
        model.setMoney1("1000.00");
        model.setDate("1");
        model.setDistance("2017-8-17");
        houselist.add(model);

        model = new BuyACarFragmentModel();
        model.setName("租房");
        model.setPraise("渝北 万科朗润园 精装单间 家...");
        model.setLet("余额: 1013.98");
        model.setMoney1("-1.00");
        model.setDate("1");
        model.setDistance("2017-8-17");
        houselist.add(model);

        model = new BuyACarFragmentModel();
        model.setName("红包转换");
        model.setPraise("6.00元红包");
        model.setLet("余额: 1014.98");
        model.setMoney1("+4.98");
        model.setDate("0");
        model.setDistance("2017-8-17");
        houselist.add(model);

        model = new BuyACarFragmentModel();
        model.setName("积分转换");
        model.setPraise("2000积分");
        model.setLet("红包余额: 6.00");
        model.setMoney1("+4.00");
        model.setDate("0");
        model.setDistance("2017-8-17");
        houselist.add(model);
        adapter.addItem(houselist);
        transactionDetailsList.setOnItemClickListener(clickListener);
    }
    AdapterView.OnItemClickListener clickListener=new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            startActivity(new Intent(context,TradingParticularsActivity.class));
        }
    };

    @Override
    public void onClick(View view) {

    }
}

